package com.luych.toolbox.data.service.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
@ConfigurationProperties("toolbox.data.datasource.proxy")
public class DataSourceProxyConfig {

    private String host;
    private int port;
    private String user;
    private String pass;
    private String path;

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public boolean validate() {
        return StringUtils.hasText(host) && port > 0 && StringUtils.hasText(user) && StringUtils.hasText(pass) && StringUtils.hasText(path);
    }
}
